<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>
        故障模块-故障点增加
    </title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="../../../css/main.css" media="all">
    <script type="text/javascript" src="../../../lib/loading/okLoading.js"></script>
    <link rel="stylesheet" href="../../../css/bootstrap.css">
    <link rel="stylesheet" href="../../../lib/layui/css/layui_2.5.7.css">
    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
    <style>
        .layui-table-page select {
            height: 22px;
        }
    </style>
</head>

<body>
<div class="x-body">



    <div class="main_box">
        <div class="panel-heading">
            <h2>增加故障点</h2>
        </div>
    </div>

    <form class="layui-form x-center">

        <div class="layui-form-pane" style="margin-top: 15px;" id="app">

            <div class="layui-form-item">
                <label class="layui-form-label">名称</label>
                <div class="layui-input-block">
                    <input  autocomplete="off"  type="text" class="layui-input" name="name" id="name" placeholder="名称">
                    <input  autocomplete="off"  type="hidden" name="modelId" id="modelId" v-model="modelId">
                    <input  autocomplete="off"  type="hidden" name="pid" id="pid" v-model="pid">
                    <input  autocomplete="off"  type="hidden" name="level" id="level" v-model="level">
                </div>
            </div>

            <div class="layui-form-item">

                <label class="layui-form-label">故障类型</label>
                <div class="layui-input-block">
                    <select name="type">
                        <option value=""></option>
                        <option value="电子故障">电子故障</option>
                        <option value="机械故障">机械故障</option>
                        <option value="其他故障">其他故障</option>
                    </select>
                </div>

            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">备注</label>
                <div class="layui-input-block">
                    <input  autocomplete="off"  type="text" class="layui-input" name="remark" id="remark" placeholder="备注">
                </div>
            </div>



            <div style="text-align: center" class="layui-form-item">
                <button class="layui-btn" type="button" lay-filter="sub" lay-submit="sub">
                    提交
                </button>
            </div>
        </div>
    </form>



</div>
</body>


<script type="text/javascript" src="../../../js/jquery.min.js"></script>
<script type="text/javascript" src="../../../js/myAjax.js"></script>
<script type="text/javascript" src="../../../js/pub.js"></script>
<script type="text/javascript" src="../../../lib/layui/layui2.5.7.js"></script>
<script type="text/javascript" src="../../../js/vue.min.js"></script>
<!-- <script src="lib/layui/layui.js" charset="utf-8"></script> -->
<script src="../../../js/x-layui.js" charset="utf-8"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script>
    layui.use(['laydate', 'element', 'laypage', 'layer', 'form'], function () {
        $ = layui.jquery;//jquery
        laydate = layui.laydate;//日期插件
        lement = layui.element;//面包导航
        laypage = layui.laypage;//分页
        layer = layui.layer;//弹出层
        var form = layui.form;
        okLoading.close($);
    });
</script>


<script>

    layui.use(['laydate', 'form'],
        function () {
            var laydate = layui.laydate;
            var form = layui.form;


            //监听审批提交
            form.on('submit(sub)',
                function (data) {
                    var name = $("#name").val();

                    if(name == ""){
                        layer.msg("请填写名称！", {
                            icon: 5
                        });
                        return false;
                    }else{
                        let form = data.field;
                        form.userId=$userId;

                        let request = {
                            url: 'maintenance/elevatorfaultpoint/add',
                            data: form,
                            method: "post",
                        };
                        sendRequest(request, (data) => {
                            if (data.code === 0) {
                                layer.alert("操作成功", {
                                        icon: 6
                                    },
                                    function () {
                                        var index = parent.layer.getFrameIndex(window.name);
                                        parent.layer.close(index);
                                        window.parent.location.reload();
                                    });
                            } else {
                                layer.alert(data.msg, {
                                    icon: 5
                                })
                            }
                        });
                        return false;
                    }


                });
        });



</script>

<script>
    var recordId = getQueryVariable("recordId");
    var pid = getQueryVariable("pid");

    var vm = new Vue({
        el: "#app",
        data: {
            modelId:null,
            pid:null,
            level:null
        },
        mounted() {
            this.statisticsFun();
        },
        methods: {
            statisticsFun() {
                this.modelId = recordId;
                this.pid = pid;
                this.level = 2;
            }
        }

    });

</script>
</html>
